package progress.exa36;

public class ToBinaryString {

    public static void main(String[] args) {
        byte a = -100;
        byte b = 100;
        //算法1
        String bri = Integer.toBinaryString((a & 0xFF) + 0x100).substring(1);
        //算法2,负数的二进制为正数的反码+1
        String bri1 = Integer.toBinaryString(~b+1);
        System.out.println(bri1.substring(bri1.length()-8));
        System.out.println(bri);
    }

}
